const Main=require('yg-Main');
const Data=require('yg-Data');

cc.Class({
    extends: cc.Component,

    properties: {
    },


    start () {
        if(Data.debug){
          Main.lobbyLoadding();
          return;
        }
        let size = wx.getSystemInfoSync();
        let button = wx.createUserInfoButton({
            type: 'text',
            text: '微信登录',
            style: {
              left: size.screenWidth/2-100,
              top: size.screenHeight-70,
              width: 200,
              height: 50,
              backgroundColor: '#0081ff',
              borderColor: '#0081ff',
              borderWidth: 1,
              borderRadius: 5,
              color: '#FFFFFF',
              textAlign: 'center',
              fontSize: 26,
              lineHeight: 50
            }
          });
          button.onTap((res) => {
            console.log('res:',res);
            if(res.errMsg==="getUserInfo:ok"){
              button.destroy();
              Object.assign(Data,res.userinfo);
              //开始加载大厅资源
              Main.lobbyLoadding();
            }
            // errMsg: "getUserInfo:ok"
//             userInfo:
// avatarUrl: "https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKEOOD6zJGuIk700ISQphowicGgnQ241pjqibpibSGHCUFeQvaviafandHkl7DehAyNnXibiaRjhFuSVpicA/132"
// city: "Changsha"
// country: "China"
// gender: 1
// language: "zh_CN"
// nickName: "陈煜"
// province: "Hunan"
          });
    },

    // update (dt) {},
});
